<?php	$p=permissionController::singleton(); ?>
<div id="page">

<div id="content">

<br>
	<table>
		<tr>
			<th>Matricola</th>
			<th>Nome</th>
			<th>Cognome</th>
			<th>Email</th>
			<th>Corso di Studio</th>
			<th>Anno Accademico</th>
			<th>Data di <br> 
			inizio mandato</th>
			<th>Data di <br> 
			fine mandato</th>
			<?php 
			$uri['controller']="Rappresentante";
			$uri['method']="Update_openViewRappresentante";
			if($p->permission($uri)){ ?>
			<th>Modifica</th>
			<?php }?>
			<?php 
     		$uri['controller']="Rappresentante";
			$uri['method']="Delete_Rappresentante";
			if($p->permission($uri)){ ?>
			<th>Cancella</th>
			<?php } ?>
		</tr>
		<?php
		foreach ($vars as $result){
			echo "<tr>
					<td >"
						.$result[Matricola]."
					</td>
					<td >"
						.$result[Nome]."
					</td>
					<td >"
						.$result[Cognome]."
					</td>
						<td >"
						.$result[Email]."
					</td>
						<td >"
						.$result['Corso di Studio']."
					</td>
						<td >"
						.$result['Anno accademico']."
					</td>
						<td >"
						.$result['Data inizio mandato']."
					</td>
						<td >"
						.$result['Data fine mandato']."
					</td>";
					 $uri['controller']="Rappresentante";						
					 $uri['method']="Update_openViewRappresentante";
					if($p->permission($uri)){ 
					echo "<td>
						<a  href='".BASE_PATH."Rappresentante/Update_openViewRappresentante/?matricola=".$result[Matricola]."'>
							<img src='".BASE_PATH."application/view/image/modifica.jpg' border='0'>
						</a>
					</td>";
					}
					$uri['controller']="Rappresentante";					
					$uri['method']="Delete_Rappresentante";
					if($p->permission($uri)){ 
					echo "<td>
						<a  href='".BASE_PATH."Rappresentante/Delete_Rappresentante/?matricola=".$result[Matricola]."'>
							<img src='".BASE_PATH."application/view/image/esci.png' border='0'>
						</a></td>";
					
				echo "</tr>";
		}}

		?>
		
		
		
		
	</table>
	<br>

		
</div>
</div>
